package com.foreverwin.mes.core.meext;

/**
 * @author Ervin Chen
 * @date 2020/4/29 15:27
 */
public enum PapiServiceEnum {
    InventoryService("com.sap.me.inventory", "InventoryService", "mepapi:com:sap:me:inventory");

    private final String moduleId;
    private final String serviceName;
    public final String namespaceURI;

    PapiServiceEnum(String moduleId, String serviceName, String namespaceURI){
        this.moduleId = moduleId;
        this.serviceName = serviceName;
        this.namespaceURI = namespaceURI;
    }

    public static PapiServiceEnum from(String moduleId, String serviceName){
        PapiServiceEnum[] defs = values();
        for(PapiServiceEnum def : defs){
            if(def.moduleId.equals(moduleId) && def.serviceName.equals(serviceName)){
                return def;
            }
        }
        throw new IllegalArgumentException("moduleId: " + moduleId + ", serviceName: " + serviceName);
    }

}
